﻿<UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
             x:Class="IndexMarkSilverlightClient.Views.Controls.DistibutionIndexes"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:my="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"  
             xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" 

             xmlns:chartingprimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit" 
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="400" Loaded="UserControl_Loaded">

    <UserControl.Resources>
        <Style TargetType="Button" x:Name="ButtonStyle">
            <Setter Property="Width" Value="24"/>
            <Setter Property="Height" Value="24"/>
            <Setter Property="Margin" Value="5,0,0,0"/>
        </Style>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White">
        
        <Grid.RowDefinitions>
            <RowDefinition Height="60"/>
            <RowDefinition />
        </Grid.RowDefinitions>
        
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <TextBlock Text="Распределение индексов по интервалам" FontSize="18" Margin="5,5,5,5" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <StackPanel Orientation="Vertical" Margin="5">
                <TextBlock Text="Число интервалов:"/>
                <ComboBox x:Name="TypeCB" SelectionChanged="TypeCB_SelectionChanged" SelectedIndex="3">
                    <ComboBox.Items>
                        <ComboBoxItem Content="2"/>
                        <ComboBoxItem Content="4"/>
                        <ComboBoxItem Content="5"/>
                        <ComboBoxItem Content="10"/>
                        <ComboBoxItem Content="20"/>
                        <ComboBoxItem Content="25"/>
                    </ComboBox.Items>
                </ComboBox>
            </StackPanel>
            
        </StackPanel>

        <my:Chart Grid.Row="1" x:Name="IndexesChart">
            <my:Chart.Template>
                <ControlTemplate TargetType="my:Chart">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <datavis:Title Grid.Row="0" Content="{TemplateBinding Title}" Style="{TemplateBinding TitleStyle}" />
                            <Grid Grid.Row="1" Margin="0,15,0,15">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}" Grid.Column="0" >
                                    <Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
                                    <Border Canvas.ZIndex="10" BorderBrush="#FF919191" BorderThickness="1" />
                                </chartingprimitives:EdgePanel>
                            </Grid>
                            <datavis:Legend x:Name="Legend" Header="{TemplateBinding LegendTitle}" Style="{TemplateBinding LegendStyle}" Grid.Row="2"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </my:Chart.Template>

            <my:Chart.Series>
                <my:ColumnSeries Title="Итоговые индексы" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}"/>
                <my:ColumnSeries Title="Индексы лидерства" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}"/>
                <my:ColumnSeries Title="Индексы гармонии" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}"/>
            </my:Chart.Series>
            
        </my:Chart>



    </Grid>
</UserControl>
